package com.charactereducation.webcore.utils;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * Created by Baggio on 2018-2-2.
 */
public class ResposeUtil {
    /**
     * 将内容输出到浏览器
     *
     * @param content 输出内容
     */
    public static void writeContent(String content, HttpServletResponse response) {

        response.reset();
        response.setCharacterEncoding("UTF-8");
        response.setHeader("Content-Type", "application/json;charset=UTF-8");
        response.setHeader("icop-content-type", "exception");
        PrintWriter writer = null;
        try {
            writer = response.getWriter();
        } catch (IOException e) {
            e.printStackTrace();
        }
        writer.print(content);
        writer.flush();
        writer.close();
    }
}
